#include <linux/module.h>
#include <linux/init.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/leds.h>

static struct gpio_led leds[] = {
	{
		.name			= "green",
		.default_trigger	= "mmc0",
		.gpio			= 362,
		.active_low		= 0,
		.retain_state_suspended	= 0,
		.default_state		= LEDS_GPIO_DEFSTATE_ON,
	},
	{
		.name			= "red",
		.default_trigger	= "heartbeat",
		.gpio			= 17,
		.active_low		= 0,
		.retain_state_suspended	= 0,
		.default_state		= LEDS_GPIO_DEFSTATE_ON,
	},
};

static struct gpio_led_platform_data led_pdata = {
	.num_leds	= ARRAY_SIZE(leds),
	.leds		= leds,
	.gpio_blink_set	= NULL,
};

static void led_release(struct device *dev)
{

}

static struct platform_device leds_pdev = {
	.name   = "leds-gpio",
	.id     = -1,
	.dev    = {
		.platform_data  = &led_pdata,
		.release	= led_release,
	},
};

static int __init gpio_led_init(void)
{
	int ret = 0;

	ret = platform_device_register(&leds_pdev);

	return ret;
}

static void __exit gpio_led_exit(void)
{
	platform_device_unregister(&leds_pdev);
}

module_init(gpio_led_init);
module_exit(gpio_led_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("YYW");
